package net.zjitc.controller;

import net.zjitc.domain.Category;
import net.zjitc.service.Impl.ServiceImpl;
import net.zjitc.service.Service;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by guo on 2017/11/12.
 */
@WebServlet(name = "ShowCategoryServlet",urlPatterns = "/showCategoryServlet")
public class ShowCategoryServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int cid = Integer.valueOf(request.getParameter("cid"));
        Service service=new ServiceImpl();
          Category category= service.findCategoryId(cid);
        request.setAttribute("category",category);
        request.getRequestDispatcher("admin/user/editcategory.jsp").forward(request,response);
    }
}
